import { UserInfoApi } from "@/request/api"
export default {
    namespaced: true,
    state: {
        userInfo: {
            nickName: "至靓仔",
            coin: '--',
            headImg: require('../../assets/img/service.848ec511.png')
        },
        cartTotal: 0,
    },
    mutations: {
        // 修改是否显示模态框的数据
        changeUserInfo(state, payload) {
            // console.log({ payload });
            state.userInfo = payload.userInfo
            state.cartTotal = payload.cartTotal
        }
    },
    actions: {
        async asyncChangeUserInfo({ commit }) {
            let user = await UserInfoApi()
            // console.log({ user });
            console.log('user', user.data);
            commit('changeUserInfo', user.data)
        }
    }
}